//---------------------------------------------------------------------
//  This file is part of the Background Motion solution.
// 
//  Copyright (C) Mindscape (TM).  All rights reserved.
//  http://www.mindscape.co.nz
// 
//  THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
//  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//  PARTICULAR PURPOSE.
//---------------------------------------------------------------------

using System.Security.Principal;

namespace Mindscape.BackgroundMotion.Model.Security
{
  /// <summary>
  /// Represents an authorized user of the system
  /// </summary>
  /// <remarks>
  /// This class currently holds no authorization state
  /// </remarks>
  public class BackgroundMotionPrincipal : IPrincipal
  {
    private BackgroundMotionIdentity _identity;

    /// <summary>
    /// Initializes a new instance of the <see cref="BackgroundMotionPrincipal"/> class.
    /// </summary>
    /// <param name="identity">The identity.</param>
    public BackgroundMotionPrincipal(BackgroundMotionIdentity identity)
    {
      _identity = identity;
    }

    /// <summary>
    /// Gets the identity of the current principal.
    /// </summary>
    /// <value></value>
    /// <returns>The <see cref="T:System.Security.Principal.IIdentity"></see> object associated with the current principal.</returns>
    public IIdentity Identity
    {
      get { return _identity; }
    }

    /// <summary>
    /// Determines whether the current principal belongs to the specified role.
    /// </summary>
    /// <param name="role">The name of the role for which to check membership.</param>
    /// <returns>
    /// true if the current principal is a member of the specified role; otherwise, false.
    /// </returns>
    /// <remarks>
    /// Currently not used so returns a fixed value of true
    /// </remarks>
    public bool IsInRole(string role)
    {
      // TODO: Implement role based logic
      return true;
    }
  }
}